﻿<template>
  <div v-loading = 'loading' :element-loading-text = 'loadingText'>
    <V-Title :titleName = 'titleName'></V-Title>
    <template v-if = 'pageFormInfo && pageFormInfo.pageConfig.hadWorkflow && pageFormInfo.pageConfig.relatedWorkflow'>
      <!-- 上部展示按钮组 -->
      <div style = 'margin: 10px 0'>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('Delete', workflowBtnStatus.Delete[0].btnName)" v-if = 'workflowBtnStatus.Delete.length'>
          <i class = 'iconfont icon-shanchu'></i>{{workflowBtnStatus.Delete[0].btnName ? workflowBtnStatus.Delete[0].btnName : '删除'}}
        </el-button>
        <!-- 保存需要区分是新增保存还是编辑保存 -->
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('Save_add', workflowBtnStatus.Save_add[0].btnName)" v-if = 'workflowBtnStatus.Save_add.length && !workFlowParams.primaryKey'>
          <i class = 'iconfont icon-baocun'></i>{{workflowBtnStatus.Save_add[0].btnName ? workflowBtnStatus.Save_add[0].btnName : '保存'}}
        </el-button>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('Save_edit', workflowBtnStatus.Save_edit[0].btnName)" v-if = 'workflowBtnStatus.Save_edit.length && workFlowParams.primaryKey'>
          <i class = 'iconfont icon-baocun'></i>{{workflowBtnStatus.Save_edit[0].btnName ? workflowBtnStatus.Save_edit[0].btnName : '保存'}}
        </el-button>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('Submit', workflowBtnStatus.Submit[0].btnName)" v-if = 'workflowBtnStatus.Submit.length'>
          <i class = 'iconfont icon-tijiao-'></i>{{workflowBtnStatus.Submit[0].btnName ? workflowBtnStatus.Submit[0].btnName : '提交'}}
        </el-button>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('Pass', workflowBtnStatus.Pass[0].btnName)" v-if = 'workflowBtnStatus.Pass.length'>
          <i class = 'iconfont icon-tongguo'></i>{{workflowBtnStatus.Pass[0].btnName ? workflowBtnStatus.Pass[0].btnName : '通过'}}
        </el-button>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('Apply', workflowBtnStatus.Apply[0].btnName)" v-if = 'workflowBtnStatus.Apply.length'>
          <i class='iconfont icon-daichulidingdan'></i>{{workflowBtnStatus.Apply[0].btnName ? workflowBtnStatus.Apply[0].btnName : '申请'}}
        </el-button>
        <!-- 驳回分选择驳回（点击按钮会出现选择人员弹窗）和自动驳回（驳回的人员已自动选择） -->
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('Reject', workflowBtnStatus.Reject[0].btnName)" v-if = 'workflowBtnStatus.Reject.length'>
          <i class = 'iconfont icon-shenpibohui'></i>{{workflowBtnStatus.Reject[0].btnName ? workflowBtnStatus.Reject[0].btnName : '驳回'}}
        </el-button>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('SelectReject', workflowBtnStatus.SelectReject[0].btnName)" v-if = 'workflowBtnStatus.SelectReject.length'>
          <i class = 'iconfont icon-shenpibohui'></i>{{workflowBtnStatus.SelectReject[0].btnName ? workflowBtnStatus.SelectReject[0].btnName : '驳回'}}
        </el-button>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('Stop', workflowBtnStatus.Stop[0].btnName)" v-if = 'workflowBtnStatus.Stop.length'>
          <i class = 'iconfont icon-zhongzhi'></i>{{workflowBtnStatus.Stop[0].btnName ? workflowBtnStatus.Stop[0].btnName : '终止'}}
        </el-button>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('SubmitPending', workflowBtnStatus.SubmitPending[0].btnName)" v-if = 'workflowBtnStatus.SubmitPending.length'>
          <i class = 'iconfont icon-zhongzhi'></i>{{workflowBtnStatus.SubmitPending[0].btnName ? workflowBtnStatus.SubmitPending[0].btnName : '提交挂起'}}
        </el-button>
        <el-button type = 'primary' size = 'mini' @click = "workflowMethod('ActivePending', workflowBtnStatus.ActivePending[0].btnName)" v-if = 'workflowBtnStatus.ActivePending.length'>
          <i class = 'iconfont icon-zhongzhi'></i>{{workflowBtnStatus.ActivePending[0].btnName ? workflowBtnStatus.ActivePending[0].btnName : '恢复挂起'}}
        </el-button>
      </div>
      <el-tabs v-model = 'currentShow'>
        <el-tab-pane label = '基础信息' name = 'basicInfo'>
          <Show-Form-Menu-Layout ref='formMenuLayout' @getFormData = 'getFormData' @triggerSelfdefineEvent = 'triggerSelfdefineEvent' @resetFormData = 'resetFormData' @openDialog = 'openDialog' @handelRowEvents = 'handelRowEvents'
          :fatherName = 'titleName' :changeModels.sync = 'changeModels' :pageRow = 'clickRow' :models.sync="models" :rules="rules" :pageFormInfo.sync = 'pageFormInfo' :dynamicUid = 'dynamicUid' @reloadCurrentPage = 'reloadCurrentPage'></Show-Form-Menu-Layout>
        </el-tab-pane>
        <el-tab-pane label = '审核信息' name = 'stepsInfo'>
          <steps-show :isShow = 'currentShow' :primaryKey = 'workFlowParams.primaryKey'></steps-show>
        </el-tab-pane>
        <el-tab-pane label = '流程信息' name = 'workflowInfo'>
          <workflow-show :WFID = 'pageFormInfo.pageConfig.relatedWorkflow' :isShow = 'currentShow' :primaryKey = 'workFlowParams.primaryKey'></workflow-show>
        </el-tab-pane>
      </el-tabs>
    </template>
    <div class='page_mainContent' v-else>
      <Show-Form-Menu-Layout ref='formMenuLayout' @getFormData = 'getFormData' @triggerSelfdefineEvent = 'triggerSelfdefineEvent' @resetFormData = 'resetFormData' @openDialog = 'openDialog' @handelRowEvents = 'handelRowEvents'
      :fatherName = 'titleName' :changeModels.sync = 'changeModels' :pageRow = 'clickRow' :models.sync="models" :rules="rules" :pageFormInfo.sync = 'pageFormInfo' :dynamicUid = 'dynamicUid' @reloadCurrentPage = 'reloadCurrentPage'></Show-Form-Menu-Layout>
    </div>
    <!-- 关联的弹窗的页面 -->
    <Dynamic-menu-dialog :dynamicUid = 'relatedPageUid' :dynamicMenuDialogVisible = 'retatedPageVisible' :currentRow = 'clickRow' :dialogType = 'dialogType' :primaryKey = 'workFlowParams.primaryKey'
    @closeDynamicMenuDialogSuccess = 'closeDynamicMenuDialogSuccess' @closeDynamicMenuDialog = 'retatedPageVisible = false'></Dynamic-menu-dialog>
    <!-- 特殊节点需要选人时 -->
    <Choose-Users v-if = 'pageFormInfo && pageFormInfo.pageConfig.hadWorkflow && pageFormInfo.pageConfig.relatedWorkflow && pageFormInfo.pageConfig.relatedWorkflowNode'
    :showUserDialog = 'showUserDialog' :PrimaryKey = 'workFlowParams.primaryKey' :NodeID = 'pageFormInfo.pageConfig.relatedWorkflowNode'
    @giveUpChooseUser = 'giveUpChooseUser' @choosedUsersSuccess = 'choosedUsersSuccess'></Choose-Users>
    <!-- 执行事件相关操作 -->
    <WS-Trigger :wsConsoleDialog = 'wsDialogInfo.visible' :wsTitle = 'wsDialogInfo.title' :wsApiRouter = 'wsDialogInfo.wsApiRouter'
    @wsConsoleDialogClosed = 'wsDialogInfo.visible = false'></WS-Trigger>
  </div>
</template>

<script src='./dynamicWorkflowMenu.js'></script>
